import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
// import { createSSRApp } from 'vue'
// export function createApp() {
//   const app = createSSRApp(App)
//   return {
//     app
//   }
// }
// 导入 pinia 实例
// import pinia from './stores'
import {
	createPinia
} from 'pinia'

import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';

import {
	createSSRApp
} from 'vue';
// npm 方式
import uViewPro, {
	httpPlugin
} from 'uview-pro';
// uni_modules 方式
// import uViewPro from "@/uni_modules/uview-pro";
import {
	httpInterceptor,
	httpRequestConfig
} from './common/http/interceptor'


import {
	setupRouter
} from '@/common/router.js'
export function createApp() {
	const app = createSSRApp(App);
	app.use(uViewPro);
	const pinia = createPinia()

	pinia.use(piniaPluginPersistedstate)
	app.use(pinia)
	setupRouter(app)

	// 注册http插件
	app.use(httpPlugin, {
		interceptor: httpInterceptor,
		requestConfig: httpRequestConfig
	})
	return {
		app
	};
}

// #endif